feat: allow block import after NUMBER_OF_COLUMNS / 2 - #8818
Conversation
Summary of ChangesHello @wemeetagain, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the handling of data columns for blocks requiring erasure coding reconstruction. It optimizes block processing by allowing earlier recognition of data availability once a sufficient number of columns are present, rather than waiting for all. This change is coupled with a more strategic, delayed approach to reconstruction, and a guarantee that all data is fully computed before being committed to storage, improving efficiency and robustness. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1438789730
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Code Review
This pull request introduces a mechanism to allow block import after a certain threshold of data columns are received, enhancing the efficiency of data availability checks. It also adds a consumer-driven delay for reconstruction and sets a reconstruction delay after the attestation cutoff during a slot. The changes involve modifications to ColumnReconstructionTracker.ts, blockInput.ts, writeBlockInputToDb.ts, and gossipHandlers.ts.
This reverts commit 0c3559d.
1438789 to
796ebef
Compare
|
@codex review |
There was a problem hiding this comment.
Pull request overview
This pull request implements a performance optimization to allow block import after receiving NUMBER_OF_COLUMNS / 2 data columns, enabling earlier block processing while reconstruction happens in the background. This addresses a performance issue where nodes experienced significant delays in block import due to reconstruction happening during gossip validation.
Changes:
- Introduces a distinction between
hasAllData(enough data to proceed with import, either all sampled columns or ≥ NUMBER_OF_COLUMNS/2 to reconstruct) andhasComputedAllData(all sampled columns actually received) - Adds
computedDataPromiseto track when all sampled columns are available, separate fromdataPromisewhich resolves when enough data exists for reconstruction - Updates
writeBlockInputToDbto wait for full column reconstruction before persisting to the database
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| packages/beacon-node/src/chain/blocks/blockInput/blockInput.ts | Adds hasComputedAllData state tracking, computedDataPromise for delayed reconstruction, and updates hasAllData logic to allow import with ≥ NUMBER_OF_COLUMNS/2 columns |
| packages/beacon-node/src/chain/blocks/writeBlockInputToDb.ts | Adds explicit wait for computed data before DB persistence to ensure all columns are available/reconstructed |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1394e26fb2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Performance Report🚀🚀 Significant benchmark improvement detected
Full benchmark results
|
lodekeeper
left a comment
There was a problem hiding this comment.
Overall the approach looks good! The separation of hasAllData (enough for reconstruction) vs hasComputedAllData (actually have all sampled columns) makes sense for the performance optimization.
One potential issue I spotted - see inline comment.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## unstable #8818 +/- ##
=========================================
Coverage 52.36% 52.36%
=========================================
Files 848 848
Lines 63704 63702 -2
Branches 4718 4718
=========================================
- Hits 33358 33357 -1
+ Misses 30277 30276 -1
Partials 69 69 🚀 New features to boost your workflow:
|
|
🎉 This PR is included in v1.40.0 🎉 |
… writes (#8974) **Motivation** - in preparation for [gloas](https://github.com/ChainSafe/lodestar/pull/8962/changes#diff-31556a76147b927f6429470ca658ba8ea013b8a869566247b9410f791988454fR32), columns and block could/should be written separately - the nice thing of having a `writeDataColumnsToDb()` function is gloas has to come up with the same interface, and reuse the code, especially `waitForComputedAllData()` to keep the same functionality we introduced in [allow block import after 64 columns](#8818) **Description** - separate`writeBlockInputToDb()` into `writeBlockAndBlobsToDb()` and `writeDataColumnsToDb()` - new `IDataColumnsInput` interface, gloas [PayloadEnvelopeInput](https://github.com/ChainSafe/lodestar/pull/8962/changes#diff-39f10cf452f670b2fe7018b493ee4c550bb6bf19d0eac2fed0a238ed7511cf36R54) is expected to implement this cc @ensi321 - only prune `this.serializedCache.clear();` for pre-gloas, need to call that after we write `PayloadEnvelopeInput` in gloas - simplify `writeDataColumnsToDb()` to accept a single `IDataColumnsInput` instead of an array because that's what the consumer need **AI Assistance Disclosure** 🤖 Generated with [Claude Code](https://claude.ai/code) --------- Co-authored-by: Tuyen Nguyen <twoeths@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: NC <17676176+ensi321@users.noreply.github.com>
… writes (ChainSafe#8974) **Motivation** - in preparation for [gloas](https://github.com/ChainSafe/lodestar/pull/8962/changes#diff-31556a76147b927f6429470ca658ba8ea013b8a869566247b9410f791988454fR32), columns and block could/should be written separately - the nice thing of having a `writeDataColumnsToDb()` function is gloas has to come up with the same interface, and reuse the code, especially `waitForComputedAllData()` to keep the same functionality we introduced in [allow block import after 64 columns](ChainSafe#8818) **Description** - separate`writeBlockInputToDb()` into `writeBlockAndBlobsToDb()` and `writeDataColumnsToDb()` - new `IDataColumnsInput` interface, gloas [PayloadEnvelopeInput](https://github.com/ChainSafe/lodestar/pull/8962/changes#diff-39f10cf452f670b2fe7018b493ee4c550bb6bf19d0eac2fed0a238ed7511cf36R54) is expected to implement this cc @ensi321 - only prune `this.serializedCache.clear();` for pre-gloas, need to call that after we write `PayloadEnvelopeInput` in gloas - simplify `writeDataColumnsToDb()` to accept a single `IDataColumnsInput` instead of an array because that's what the consumer need **AI Assistance Disclosure** 🤖 Generated with [Claude Code](https://claude.ai/code) --------- Co-authored-by: Tuyen Nguyen <twoeths@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: NC <17676176+ensi321@users.noreply.github.com>





Motivation
Description
blockInput.hasAllDatato trigger if the number of columns is enough to reconstruct (gteNUMBER_OF_COLUMNS / 2)blockInputColumns.hasComputedAllData, used to await full reconstruction duringwriteBlockInputToDb